package com.b511.swpu.cementbackend.util;

public class JSONHelper {
    public static String getPageJson(String data,int total,int pageSize,int page){
        StringBuilder jsonBuilder=new StringBuilder();
        jsonBuilder.append("[{");

        jsonBuilder.append("\""+"data"+"\":");
        if(data.equals("]")){
            jsonBuilder.append("\"\"");
        }else {
            jsonBuilder.append(data);
        }
        jsonBuilder.append(",");
        jsonBuilder.append("\""+ "total" +"\":"+total+",");
        jsonBuilder.append("\""+ "pagesize" +"\":"+pageSize+",");
        jsonBuilder.append("\""+ "page" +"\":"+page+"");
        jsonBuilder.append("}]");
        String json=jsonBuilder.toString();
        return json;
    }
}
